import java.util.ArrayList;
import java.util.Scanner;

public class Openjudge1 {

    public static void main(String[] args) {
        ArrayList<Openjudge1.Student> list=new ArrayList<>();
        int n=0;
        Scanner s=new Scanner(System.in);
        n=s.nextInt();
        int index=s.nextInt();
        for (int i = 0; i < n; i++) {
            String tmpName;
            double tmpAge;
            tmpName=s.next();
            tmpAge=s.nextDouble();
            list.add(new Openjudge1().new Student(tmpName,tmpAge));
        }
        for (int i = 0; i < list.size()-1; i++) {
            Student tmp=new Openjudge1().new Student();
            if(list.get(i).age<list.get(i+1).age){
                list.get(i).name=tmp.name;
                list.get(i).age=tmp.age;

                list.get(i).name=list.get(i+1).name;
                list.get(i).age=list.get(i+1).age;


                list.get(i+1).name=tmp.name;
                list.get(i+1).age=tmp.age;


            }
        }
        System.out.println(list.get(index-1).getName()+" "+list.get(index-1).getAge());

    }
    public class Student{
        String name;
        double age;

        public Student() {
        }

        public Student(String name, double age) {
            this.name = name;
            this.age = age;
        }

        public void setName(String name) {
            this.name = name;
        }

        public void setAge(double age) {
            this.age = age;
        }

        public String getName() {
            return name;
        }
        public double getAge() {
            return age;
        }
    }

}


